The present invention relates to a method of transformation of images, and more especially, to a method for degrading the required bit number of grayscale images by an error diffusion scheme.
In general, image-processing devices, such as scanners, printers, or fax machines, provide a certain number of memory bits to indicate a gray value of a picture element named pixel. For example, one bit is provided for a binary case where only two gray levels can be differentiated, typically, 1 for a spot and 0 for no spot. In another case, an 8-bit image-processing device provides 256 gray scales, where each gray value of a pixel is ranged from 0 to 255. As noted, the more bits can be provided for a pixel, the more gray levels can be differentiated.
Basically, different image-processing devices employ different resolutions established by different bit numbers. The resolution transformation is thus unavoidable when image data are transmitted from one device to another. For transformation from a higher resolution to a lower one, error diffusion is a well-known technique to provide such a transformation with a certain degree of degradation compensation.
When an image with a higher resolution is transformed to one with a lower resolution, image distortion will be caused due to portions of the bit number being truncated. To compensate for that, the truncated error of a pixel is distributed or diffused to some of its neighboring pixels, typically those nearest pixels downstream from the focus one. FIG. 1A shows a case in a focus pixel contributes its truncated error to the four nearest pixels downstream as indicated by the arrows. FIG. 1B shows for the same case that the truncated errors distributed in the focus pixel come from four nearest pixels upstream. Further, for the purpose of balancing image tone, the diffusions are preferably distributed in opposite directions along two immediate adjacent scan lines as shown in FIG. 1C.
However, until now, for the error diffusion method, only the method for transforming a grayscale image to a binary image has been successfully developed. These binary cases can be easily achieved using a threshold value for comparison and truncation. In these cases, those original gray values greater than a predetermined threshold value are transformed to target values of 1, and those of a lower value are transformed to 0. However, there is no error diffusion method for transforming a grayscale image to one with reduced bit number instead of transforming to a binary image.
The present invention proposes an image transformation method to degrade a N-bit grayscale image to a reduced K-bit grayscale image. Error diffusion, error bias and a programmable integer C are utilized for the present method.
Firstly, for the focus pixel, the original grayscale value is read and denoted by Gi, which is an N-bit integer with a value within [0, 2Nxe2x88x921]. The related errors Ej previously obtained from some chosen pixels are subsequently loaded. The respective corresponding weighting coefficient Wj for each error Ej is determined. Then, a resultant gray value Ri of the focus pixel after error diffusion can be calculated by the following equation:       R    i    =            G      i        +                  ∑        j            ⁢              xe2x80x83            ⁢                        w          j                ⁢                  E          j                      -    C  
Herein, C is a programmable integer for compensating the error bias and, if necessary, for adjusting the brightness of the entire target image.
Thereafter, the degradation of the gray value can be implemented by dividing the gray value Ri into a first part Mi and a second part Li, wherein Mi is a K-bit integer, Li is an (Nxe2x88x92K)-bit integer, and Mi and Li satisfy the following equations:
Mixc3x972Nxe2x88x92K+Li=Ri
xe2x88x922Nxe2x88x92K/2xe2x89xa6Li less than 2Nxe2x88x92K/2,
Li is then truncated form the resultant gray value Ri and stored as the error of the focus pixel. The error Ei of the focus pixel is stored as Li plus an error bias D of 2Nxe2x88x92K/2, that is,
Ei=Li+2Nxe2x88x92K/2.
After the error bias D of 2Nxe2x88x92K/2 is added, the computed errors will be stored as non-negative integers and fall in the range of 0xe2x89xa6Ei less than 2Nxe2x88x92Kxe2x88x921. Finally, the focus pixel is displayed using Mi as the degraded target gray value.